<?php

declare(strict_types=1);

namespace App\Api\Request;

use App\Api\Service\ConfigService;
use Mine\MineFormRequest;

class UploadRequest extends MineFormRequest
{
    public function storeRules(): array
    {
        return [
            'file' => 'required|mimes:' . $this->getMimes('upload_allow_image'),
        ];
    }

    public function attributes(): array
    {
        return [
            'file' => '上传文件',
        ];
    }

    protected function getMimes($key): string
    {
        return (string)ConfigService::get($key, '');
    }
}
